<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="next" href="NeuralNetworkIo.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class attributes" rel=Appendix href="index_attributes.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="NeuralNetwork" rel="Chapter" href="NeuralNetwork.html">
<link title="NeuralNetworkIo" rel="Chapter" href="NeuralNetworkIo.html">
<link title="Adaline" rel="Chapter" href="Adaline.html">
<link title="MlPerceptron" rel="Chapter" href="MlPerceptron.html">
<link title="SigmoidMlPerceptron" rel="Chapter" href="SigmoidMlPerceptron.html"><title>NeuralNetwork</title>
</head>
<body>
<div class="navbar">&nbsp;<a href="index.html">Up</a>
&nbsp;<a href="NeuralNetworkIo.html">Next</a>
</div>
<center><h1>Module <a href="type_NeuralNetwork.html">NeuralNetwork</a></h1></center>
<br>
<pre><span class="keyword">module</span> NeuralNetwork: <code class="code">sig</code> <a href="NeuralNetwork.html">..</a> <code class="code">end</code></pre>Defines types, the interface of a feedforward neural network and useful functions<br>
<hr width="100%">
<pre><span class="keyword">exception</span> <a name="EXCEPTIONWrong_input"></a>Wrong_input</pre>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONWrong_input_size"></a>Wrong_input_size</pre>
<pre><span class="keyword">val</span> <a name="VAL(|>)"></a>(|&gt;) : <code class="type">'a -> ('a -> 'b) -> 'b</code></pre><div class="info">
Pipe operator<br>
</div>
<pre><span class="keyword">val</span> <a name="VAL(+|)"></a>(+|) : <code class="type">float array -> float array -> float array</code></pre><div class="info">
Vectors addition<br>
</div>
<pre><span class="keyword">val</span> <a name="VAL(-|)"></a>(-|) : <code class="type">float array -> float array -> float array</code></pre><div class="info">
Vectors substraction<br>
</div>
<pre><span class="keyword">type</span> <a name="TYPEvector"></a><code class="type"></code>vector = <code class="type">float array</code> </pre>

<br><code><span class="keyword">type</span> <a name="TYPElayer"></a><code class="type"></code>layer = {</code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>weights&nbsp;: <code class="type">float Matrix.matrix</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>bias&nbsp;: <code class="type"><a href="NeuralNetwork.html#TYPEvector">vector</a></code>;</code></td>

</tr></table>
}

<div class="info">
Implements a neurons layer<br>
</div>

<br><code><span class="keyword">type</span> <a name="TYPEthreshold"></a><code class="type"></code>threshold = {</code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>f&nbsp;: <code class="type">float -> float</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>d&nbsp;: <code class="type">float -> float</code>;</code></td>

</tr></table>
}


<br><code><span class="keyword">type</span> <a name="TYPEactivation"></a><code class="type"></code>activation = </code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Linear</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Sigmoid</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Custom</span> <span class="keyword">of</span> <code class="type"><a href="NeuralNetwork.html#TYPEthreshold">threshold</a></code></code></td>

</tr></table>


<pre><span class="keyword">class</span> <a name="TYPEneuralNetwork"></a><span class="keyword">virtual</span> <a href="NeuralNetwork.neuralNetwork.html">neuralNetwork</a> : <code class="type">int -> int -> </code><code class="code">object</code> <a href="NeuralNetwork.neuralNetwork.html">..</a> <code class="code">end</code></pre><br>
<code class="code">new neuralNetwork input_size output_size</code>
Implements a virtual neural network class<br>
<pre><span class="keyword">val</span> <a name="VALstring_of_array"></a>string_of_array : <code class="type">float array -> string</code></pre><div class="info">
<b>Returns</b> string representation of an array in order to write a file<br>
</div>
<pre><span class="keyword">val</span> <a name="VALstring_of_weights"></a>string_of_weights : <code class="type">float Matrix.matrix -> string</code></pre><div class="info">
<b>Returns</b> string representation of a matrix of weights in order to write a file<br>
</div>
<pre><span class="keyword">val</span> <a name="VALiter_random"></a>iter_random : <code class="type">('a -> unit) -> 'a array -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALarray_map2"></a>array_map2 : <code class="type">('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array</code></pre><pre><span class="keyword">val</span> <a name="VALlearn_base"></a>learn_base : <code class="type">< learn : float -> float array -> float array -> unit; .. > -><br>       float -> (float array * float array) array -> unit</code></pre><div class="info">
<code class="code">learn_base perceptron rate base</code> makes the perceptron learn at the rate given on the learning base where<ul>
<li>base is an array of tuples : (input, desired output)</li>
</ul>
<br>
</div>
<pre><span class="keyword">val</span> <a name="VALlearn_random_base"></a>learn_random_base : <code class="type">< learn : float -> float array -> float array -> unit; .. > -><br>       float -> (float array * float array) array -> unit</code></pre><div class="info">
<code class="code">learn_base perceptron rate base</code> makes the perceptron learn at the rate given on the learning base in a random order where<ul>
<li>base is an array of tuples : (input, desired output)</li>
</ul>
<br>
</div>
</body></html>